package com.yishu.user.service.impl;

import com.yishu.user.mapper.UserMapper;
import com.yishu.user.service.UserService;
import com.ys.commons.model.dto.UserDto;
import com.ys.commons.model.po.User;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 *
 * @author zengchao
 * @date 2021-07-03 09:47:16
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public UserDto getUser(Integer id) {
        User user = userMapper.selectById(id);
        if (user == null){
            return null;
        }
        UserDto userDto = new UserDto();
        BeanUtils.copyProperties(user,userDto);
        return userDto;
    }
}
